<template>
  <view 
    class="list-item" 
    :class="{'selected-item': isSelected && isEditMode}"
    @click="$emit('click')" 
    @longpress="$emit('longpress')"
  >
    <!-- 选择标记 -->
    <view class="album-selection" v-if="isEditMode">
      <view 
        class="selection-circle" 
        :class="{'selected': isSelected}"
        @click.stop="$emit('select')"
      >
        <uni-icons v-if="isSelected" type="checkmarkempty" size="14" color="#fff"></uni-icons>
      </view>
    </view>
    
    <!-- 相册封面 -->
    <image class="list-cover" :src="album.cover" mode="aspectFill"></image>
    
    <!-- 相册信息 -->
    <view class="list-info">
      <text class="list-name">{{album.name}}</text>
      <text class="list-details">{{album.photos.length}}张 · {{album.date}}</text>
    </view>
    
    <!-- 更多操作按钮或右箭头 -->
    <view class="list-more" v-if="!isEditMode" @click.stop="$emit('more')">
      <uni-icons type="more-filled" size="20" color="#999"></uni-icons>
    </view>
    <uni-icons v-else type="right" size="16" color="#ccc"></uni-icons>
  </view>
</template>

<script>
export default {
  name: 'AlbumListItem',
  props: {
    album: {
      type: Object,
      required: true
    },
    isEditMode: {
      type: Boolean,
      default: false
    },
    isSelected: {
      type: Boolean,
      default: false
    }
  }
}
</script>

<style scoped>
.list-item {
  display: flex;
  align-items: center;
  padding: 25rpx 30rpx;
  border-bottom: 1px solid #f0f0f0;
  position: relative;
  transition: background-color 0.2s;
}

.selected-item {
  background-color: #f0f8f0;
}

.album-selection {
  margin-right: 15rpx;
}

.selection-circle {
  width: 40rpx;
  height: 40rpx;
  border-radius: 20rpx;
  border: 2px solid #3a8838;
  background-color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
}

.selection-circle.selected {
  background-color: #3a8838;
}

.list-cover {
  width: 100rpx;
  height: 100rpx;
  border-radius: 10rpx;
  margin-right: 20rpx;
}

.list-info {
  flex: 1;
}

.list-name {
  font-size: 28rpx;
  color: #333;
  margin-bottom: 5rpx;
  display: block;
}

.list-details {
  font-size: 24rpx;
  color: #999;
}

.list-more {
  padding: 10rpx;
}
</style> 